<%@ Page Title="" Language="C#" MasterPageFile="~/SiteWorx/ControlPanel.master" AutoEventWireup="true"
    CodeFile="OrderManagement.aspx.cs" Inherits="SiteWorx_OrderManagement" Theme="Admin"
    StylesheetTheme="Admin" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="cntHead" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="cntMain" ContentPlaceHolderID="cphMain" runat="Server">
    <telerik:RadAjaxPanel runat="server" ID="rapnlOrderManagement" HorizontalAlign="NotSet"
        LoadingPanelID="ralOrderManagement">
        <span class="siteWorxTitle">Order Management</span>
        <asp:Panel runat="server" ID="pnlOrderList">
            <fieldset style="width: 510px;">
                <legend>Pending Orders</legend>
                <telerik:RadGrid ID="rgvOrderList" runat="server" AutoGenerateColumns="False" Width="504px"
                    Skin="Telerik" GridLines="None" OnItemCommand="rgvOrderList_ItemCommand" OnItemDataBound="rgvOrderList_ItemDataBound">
                    <HeaderContextMenu EnableTheming="True" Skin="Telerik">
                        <CollapseAnimation Duration="200" Type="OutQuint" />
                    </HeaderContextMenu>
                    <MasterTableView>
                        <RowIndicatorColumn>
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px" />
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridTemplateColumn HeaderText="Order Number" UniqueName="ID">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lnkbtnOrderId" runat="server" Text='<%# Eval("ID") %>' CommandName="Select"
                                        CommandArgument='<%# Eval("ID") %>'></asp:LinkButton>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Status" UniqueName="Status">
                                <ItemTemplate>
                                    <asp:Label ID="lblStatus" runat="server" Text='<%# Eval("Status") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Ordered By" UniqueName="CreatedBy">
                                <ItemTemplate>
                                    <asp:Label ID="lblOrderedBy" runat="server"></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Order Date" UniqueName="CreatedDate">
                                <ItemTemplate>
                                    <asp:Label ID="lblOrderDate" runat="server" Text='<%# Eval("CreatedDate") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                    </MasterTableView><FilterMenu EnableTheming="True" Skin="Telerik">
                        <CollapseAnimation Duration="200" Type="OutQuint" />
                    </FilterMenu>
                </telerik:RadGrid><br />
        </asp:Panel>
        <asp:Panel runat="server" ID="pnlOrderDetails" Width="460">
            <div style="padding: 2px; text-align: right; vertical-align: middle;">
                <a href="PrintOrder.aspx" target="_blank">
                    <img src="../App_Themes/Admin/Images/printer.gif" border="0"></a>&nbsp;<a href="PrintOrder.aspx" target="_blank">Printer
                        Friendly</a></div>
            <table border="0" class="form" width="460">
                <tr>
                    <td class="label" style="width: 124px">
                        Order Number:
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lblOrderNumber"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="label" style="width: 124px">
                        Status:
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lblOrderStatus"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="label" style="width: 124px">
                        TaxId:
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lblTaxId"></asp:Label>
                    </td>
                </tr>
            </table>
            <fieldset>
                <legend>Shipping Details</legend>
                <table>
                    <tr>
                        <td valign="top">
                            <asp:Label runat="server" ID="lblShippingAddressInfo"></asp:Label>
                        </td>
                        <td valign="top">
                            <asp:Label runat="server" ID="lblShippingMethod"></asp:Label>
                        </td>
                    </tr>
                </table>
            </fieldset>
            <br />
            <fieldset>
                <legend>Billing Details</legend>
                <table>
                    <tr>
                        <td valign="top">
                            <asp:Label runat="server" ID="lblBillingAddressInfo"></asp:Label>
                        </td>
                    </tr>
                </table>
            </fieldset>
            <br />
            <fieldset>
                <legend>Payment Details</legend>
                <table>
                    <tr valign="top">
                        <td>
                            <asp:Label runat="server" ID="lblCardType"></asp:Label>
                        </td>
                    </tr>
                    <tr valign="top">
                        <td>
                            <asp:Label runat="server" ID="lblNameOnCard"></asp:Label>
                        </td>
                    </tr>
                    <tr valign="middle">
                        <td valign="middle">
                            <asp:Label runat="server" ID="lblCardNumber"></asp:Label>&nbsp;&nbsp;<asp:Button
                                runat="server" ID="btnGetCardNumber" Text="View" OnClick="btnGetCardNumber_Click" />
                        </td>
                    </tr>
                    <tr valign="top">
                        <td>
                            <asp:Label runat="server" ID="lblExpirationMonth"></asp:Label>/<asp:Label runat="server"
                                ID="lblExpirationYear"></asp:Label>
                        </td>
                    </tr>
                </table>
            </fieldset>
            <br />
            <fieldset style="width: 520px;">
                <legend>Order Details</legend>
                <telerik:RadGrid ID="rgvOrderItems" runat="server" AutoGenerateColumns="False" Width="504px"
                    Skin="Telerik" GridLines="None" 
                    onitemdatabound="rgvOrderItems_ItemDataBound" ShowFooter="true">
                    <HeaderContextMenu EnableTheming="True" Skin="Telerik">
                        <CollapseAnimation Duration="200" Type="OutQuint" />
                    </HeaderContextMenu>
                    <MasterTableView>
                        <RowIndicatorColumn>
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px" />
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridTemplateColumn HeaderText="Item Number" UniqueName="ItemNumber">
                                <ItemTemplate>
                                    <asp:Label ID="lblItemNumber" runat="server" Text='<%# Eval("ItemNumber") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Product" UniqueName="ProductTitle">
                                <ItemTemplate>
                                    <asp:Label ID="lblProductTitle" runat="server" Text='<%# Eval("ProductTitle") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Unit Price" UniqueName="UnitPrice">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblUnitPrice" Text='<%# Eval("UnitPrice", "{0:c}") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Quantity" UniqueName="Quantity">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblQuantity" Text='<%# Eval("Quantity") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Total" UniqueName="Total">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblTotal" Text='<%# Eval("Total", "{0:c}") %>'></asp:Label>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <asp:Label runat="server" ID="lblGrandTotal" Font-Bold="true"></asp:Label>
                                </FooterTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                    </MasterTableView><FilterMenu EnableTheming="True" Skin="Telerik">
                        <CollapseAnimation Duration="200" Type="OutQuint" />
                    </FilterMenu>
                </telerik:RadGrid>
            </fieldset>
            <br />
            <asp:Literal runat="server" ID="litOrderUpdateSection"></asp:Literal>
            <br />
            <br />
            <asp:Button runat="server" ID="btnProcessed" Text="Processed" OnClick="btnProcessed_Click" />&nbsp;<asp:Button
                runat="server" ID="btnDenied" Text="Denied" OnClick="btnDenied_Click" />&nbsp;<asp:Button
                    runat="server" ID="btnCancel" Text="Cancel" CausesValidation="false" OnClick="btnCancel_Click" /><br />
            <asp:Label runat="server" ID="lblMessage" ForeColor="Red"></asp:Label>
        </asp:Panel>
    </telerik:RadAjaxPanel>
    <telerik:RadAjaxLoadingPanel ID="ralOrderManagement" runat="server" Height="75px"
        Width="75px" Style="position: relative; top: -50%; left: 45%;" IsSticky="true">
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
            style="border: 0px;" />
    </telerik:RadAjaxLoadingPanel>
</asp:Content>
